package com.wn.ziroombackend.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wn.ziroombackend.entity.Streets;
import com.wn.ziroombackend.service.StreetsService;
import com.wn.ziroombackend.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author wangzhijia
 * @since 2023-02-28 10:03:42
 */
@RestController
@RequestMapping("/streets")
public class StreetsController {

    @Autowired
    private StreetsService streetsService;

    @GetMapping("/getStreetsByArea")
    public R getStreetsByArea(String code) {
        LambdaQueryWrapper<Streets> streetsLambdaQueryWrapper = new LambdaQueryWrapper<>();
        streetsLambdaQueryWrapper.eq(Streets::getAreaCode, code).eq(Streets::getProvinceCode, 31);
        List<Streets> list = streetsService.list(streetsLambdaQueryWrapper);
        return R.ok("OK").data("streetList", list);
    }


}

